<?php
	session_start();
	if(isset($_POST['message'])){
		$message = $_POST['message'];
		try{
			addMessage($message);	
		}catch (Exception $e){
			echo $e;
		}
	}

	function addMessage($messageParam){
		$chatLogPath = "../log/chatLog.txt";
		$data = "<font color='".$_SESSION['loginColor']."'>".$_POST['user']."</font>: ".$messageParam."<br/>";
		file_put_contents($chatLogPath, $data, FILE_APPEND);
	}
	
?>
